
package com.ocn.li.scmdy.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.lang.reflect.Field;

/**
 * @author ：Li9527
 * @date ：Created in 2019-04-01 17:17
 * @description：项目启动就执行的工具类
 * @modified By：
 * @version: 1.0
 */
@Slf4j
@Component
public class InitConfig implements InitializingBean {

	@Autowired
	DemoConfig demoConfig;

	@Autowired
	HorizonConfig horizonConfig;

	@Autowired
	QcloudConfig qcloudConfig;

	@Override
	public void afterPropertiesSet() throws Exception {
        log.info("测试配置开始加载");
		reflect(demoConfig);
		log.info("工作流配置开始加载");
		reflect(horizonConfig);
		log.info("腾讯云配置开始加载");
		reflect(qcloudConfig);
	}

	public static void reflect(Object o) throws IllegalAccessException {
		Class cls = o.getClass();
		Field[] fields = cls.getDeclaredFields();
		for (int i = 0; i < fields.length; i++) {
			Field f = fields[i];
			f.setAccessible(true);
            log.info(f.getName() + "----:" + f.get(o));
		}
	}
}
